
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,member-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet"
	type="text/css" />
<link href="css/pagination.css" rel="stylesheet" type="text/css" />
	
<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>货品管理</title>
</head>
<body>
	<nav class="breadcrumb">
		<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 商品中心 <span class="c-gray en">&gt;</span> 货品管理 

		<a class="btn btn-success btn-refresh radius r mr-20"
			style="line-height:1.6em;margin-top:3px" onclick="javascript:location.replace(location.href);"
			href="javascript:location.replace(location.href);" title="刷新">刷新</a>
	</nav>
	<div class="pd-20">
	
		<div class="cl pd-5 bg-1 bk-gray"> 
		<form action="<%=path%>/backstage/t_products-list" method="get" class="form form-horizontal" id="search-form" onsubmit="beforSubmit()">
			<div class="text-c"> 
				<div class="row cl mb-15">
					<label class="form-label col-1">商品编号或商品名称：</label>
					<div class="formControls col-2">
					<input type="text" name="name" value="${conditions.name}" id="name" placeholder="商品编号或商品名称" class="input-text col-2">
					</div>
					
					<input type="hidden" name="type" id="endType" value="${conditions.type}">
					<label class="form-label col-1">所属品类：</label>
					<div class="formControls col-2"> 
						<span class="select-box">
							<select class="select" name="type1" id="type1" onchange="firstChange(this);">
								<option value="-1">--大类--</option>
								<c:forEach items="${types1}" var="type">
									<option value="${type.cCode}" <c:if test="${type.cCode==conditions.type1}">selected</c:if> >${type.cName}</option>
								</c:forEach>
							</select>
						</span>
		   			</div>
				   <div class="formControls col-2"> <span class="select-box">
						<select class="select" name="type2" id="type2" onchange="secondChange(this);">
							<option value="-1">--中类--</option>
							<c:forEach items="${types2}" var="type">
							<option value="${type.cCode}" <c:if test="${type.cCode==conditions.type2}">selected</c:if> >${type.cName}</option>
							</c:forEach>
						</select>
						</span>
				   </div>
				   <div class="formControls col-2"> <span class="select-box">
						<select class="select" name="type3" id="type3">
							<option value="-1">--小类--</option>
							<c:forEach items="${types3}" var="type">
							<option value="${type.cCode}" <c:if test="${type.cCode==conditions.type3}">selected</c:if> >${type.cName}</option>
							</c:forEach>
						</select>
						</span>
				   </div>
				</div>
				
				<div class="row cl">
					<label class="form-label col-1">所在站点：</label>
					<div class="formControls col-2">
						<span class="select-box">
							<select name="city_id" class="select" onchange="ciytChange(this);" datatype="n" nullmsg="请选择县市">
								<option value="-1">--所在站点--</option>
								<c:forEach items="${citys}" var="city">
								<option value="${city.id}" <c:if test="${city.id==conditions.city_id}">selected</c:if> >${city.name}</option>
								</c:forEach>
							</select>
						</span>
					</div>
					
					<label class="form-label col-2">最大库存量：</label>
					<div class="formControls col-1">
					<input type="text" name="store" value="${conditions.store}" id="store" placeholder="最大库存量" class="input-text col-2">
					</div>

					<label class="form-label col-1">库位：</label>
					<div class="formControls col-2">
						<input type="text" name="location" value="${conditions.location}" id="location" placeholder="库位" class="input-text col-2">
					</div>
					<div class="formControls col-3">
						<button name="" id="" class="btn btn-success  ml-10" type="submit">
							 查询
						</button>
						&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
						<button name="" onclick="theReset();" id="" class="btn btn-success" >
							 重置
						</button>
					</div>
			</div>
			</div>
		</form>
		</div>
		
		<div class="mt-20">
			<table
				class="table table-border table-bordered table-hover table-bg table-sort">
				<thead>
					<tr class="text-c">
						<th width="40">ID</th>
		
                            <th >商品编号</th>
                            <th>名称</th>
                            <th width="80">市场价</th>
                            <th width="80">价格</th>
                            <th>规格</th>
							<th width="80">库位</th>
                            <th width="80">库存</th>
                            <th width="80">单位</th>
                            <th width="80">分站名称</th>
                     
                            <th width="80">已售数量</th>
                            <!-- <th width="80">是否置顶</th> -->
						<!-- <th width="100">操作</th> -->
					</tr>
				</thead>
				<tbody>
						<c:forEach items="${t_productss}" var="t_products">
						
						<tr class="text-c">
							<input type="hidden" id="id" name="id"
								value='${t_products.product_id}' />
                            <td>${t_products.product_id}</td>

                                <td>${t_products.goods_id}</td>
                                <td>${t_products.name}</td>
                                <td>${t_products.mkt_price}</td>
                                <td>${t_products.price}</td>
                                <td>${t_products.pdt_spec}</td>
								<td>${t_products.erp_location}</td>
                                <td>${t_products.store}</td>
                                <td>${t_products.unit}</td>
   
                                <td>${t_products.cityName}</td>
                                <td>${t_products.sold}</td>
                                

							<!--<td class="td-manage">
							<a style="text-decoration:none"
								onClick="t_products_edit(this,'${t_products.product_id}')" href="javascript:void(0);"
								title="编辑">编辑</a>
								&nbsp;&nbsp;&nbsp;&nbsp;
								<a style="text-decoration:none"
								onClick="t_products_delete(this,'${t_products.product_id}')" href="javascript:void(0);"
								title="删除">删除</a>
							</td>-->
						</tr>
					</c:forEach>
				</tbody>
			</table>
			<div id="Pagination" class="page-con"></div>
		</div>
	</div>
	<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="lib/layer/1.9.3/layer.js"></script>
	<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
	<script type="text/javascript" src="lib/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript"
		src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
	<script type="text/javascript" src="js/H-ui.js"></script>
	<script type="text/javascript" src="js/H-ui.admin.js"></script>
	<script type="text/javascript" src="js/jquery.pagination.js"></script>
	
	<script type="text/javascript">
	$(function() {
		initPager();
	});
	
	var showCount = ${pageInfo.showCount};
	var currentPage = ${pageInfo.currentPage-1};
	var totalResult = ${pageInfo.totalResult};
	function initPager(){
		$("#Pagination").pagination(totalResult, {
            callback: function(new_page_index, pagination_container){
            	var oldLocation = location.href;
            	var pa = "currentPage=" + (new_page_index+1);
        		var shoC = "showCount=" + showCount;
            	var index = oldLocation.lastIndexOf("?");
            	if (index == -1){
            		location.href = oldLocation + "?" + pa + "&" + shoC;
            	}else if (oldLocation.indexOf("currentPage") == -1){
            		location.href = oldLocation + "&" + pa;
            	}else if (oldLocation.indexOf("showCount") == -1){
            		location.href = oldLocation + "&" + shoC;
            	}else{
            		var temp = oldLocation.replace(/currentPage=\d+/, pa);
					var newLocation = temp.replace(/showCount=\d+/, shoC);
            		location.href = newLocation;
            	}
            	return false;
            },
            items_per_page:showCount, 
            load_first_page:false,
            prev_text:'上一页',
            next_text:'下一页',
            ellipse_text:'...',
            num_edge_entries:1,
            num_display_entries:5,
            current_page:currentPage,
        });
	}

	/*
	重置
	*/
	function theReset(){
		$("#search-form input[type='text']").val('');
		$("#search-form select").val(-1);
	}
		
		/*添加*/
		function t_products_add(title, url, w, h) {
			layer_show(title, url, w, h);
		}

		/*编辑*/
		function t_products_edit(obj,id,w,h){
			var edit_page = "<%=path%>/backstage/t_products-add-pre?id="+id;
			layer_show("编辑",edit_page,w,h);
		}

		/*删除*/
		function t_products_delete(obj,id){
			layer.confirm('确认删除？', {
				btn: ['确认','取消'], 
				shade: false
			},
			function(){
				$.ajax({
					type : "POST",
					url : "<%=path%>/backstage/t_products-delete",
					data : "id=" + id,
					error : function() {
						layer.msg('操作失败', {icon:5,time:1000});
					},
					success : function(msg) {
						layer.msg('已删除 ' + msg.information, {icon:6,time:1000});
						$(obj).parents("body").find(".btn-refresh").click();
					}
				});
			},
			function(){
				layer.msg('未删除', {icon:5,time:1000});
			});	
		}
		
		var type1;
		var type2;
		var type3;		
		function firstChange(theSelect){
					var typeId = theSelect.value;

					if (!type2){
						$.ajax({
							type:"post",
							async:false,
							url:"<%=path%>/backstage/get-types",
							data : {level:2,isZiYing:true},
							success : function(msg){
								type2 = msg;
							}
							});
						}
					var options = "<option value='-1'>--中类--</option>";
					for (var i = 0; i < type2.length; i++){
						if (typeId == type2[i].cBelong){
							var aOption = "<option value='"+type2[i].cCode+"' >"+type2[i].cName+"</option>"
							options += aOption; 
						}
					}
					$("#type2").html(options);
				}
			function secondChange(theSelect){
			var typeId = theSelect.value;

			if (!type3){
				$.ajax({
					type:"post",
					async:false,
					url:"<%=path%>/backstage/get-types",
					data : {level:3,isZiYing:true},
					success : function(msg){
						type3 = msg;
					}
					});
				}
			var options = "<option value='-1'>--小类--</option>";
			for (var i = 0; i < type3.length; i++){
				if (typeId == type3[i].cBelong){
					var aOption = "<option value='"+type3[i].cCode+"' >"+type3[i].cName+"</option>"
					options += aOption; 
				}
			}
			$("#type3").html(options);
		}	

		function beforSubmit(){
			var type1 = $("#type1").val();
			var type2 = $("#type2").val();
			var type3 = $("#type3").val();
			
			var endType = -1;
			if (type3 != -1){
				endType = type3;
			}else if (type2 != -1){
				endType = type2;
			}else if (type1 != -1){
				endType = type1;
			}
			$("#endType").val(endType);
			return true;
		}
	</script>
</body>
</html>



